package com.example.hhh.repository;

import com.example.hhh.model.Business;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.data.repository.query.Param;
import java.util.List;

@Repository
public interface BusinessRepository extends JpaRepository<Business, Integer> {

    // 根据业务类型查询
    List<Business> findByBusinessType(String type);

    // 自定义原生SQL查询
    @Query(value = "SELECT * FROM business WHERE cost BETWEEN :min AND :max", nativeQuery = true)
    List<Business> findBusinessByCostRange(@Param("min") Double min, @Param("max") Double max);
}